<template>
	<view class="" :style="{'--themcolor':usethemestore.themecolor,'--themcolor2':usethemestore.themecolor2}" v-if="orderdata">
		<view class="fixtop">
			<fixtitletopVue>
				<template #l>
					<view class="fix-l" @click="back">
						<view>
							<view class="iconfont icon-jiantou"></view>
						</view>
					</view>
				</template>
				<template #c>
					<view class="fix-c">
						支付订单
					</view>
				</template>
			</fixtitletopVue>
		</view>
		<view class="conbox">
			<view class="t">
				<view class="price">
					￥<text>{{orderdata.allprice}}</text>
				</view>
				<view class="shopername">{{orderdata.shopername}}-{{orderdata.orderid}}</view>
				<view class="zfaway">
					<view class="l">
						<view class="iconfont icon-weixinzhifu"></view>
						微信支付
					</view>
					<radio checked />
				</view>
			</view>
			<view class="b" @click="zforder">
				确认支付
			</view>
		</view>
	</view>
	
</template>

<script setup>
	import {onLoad} from "@dcloudio/uni-app"
	import {ref} from 'vue'
	import fixtitletopVue from '../../components/fixtitletop/fixtitletop.vue';
	import {
		getstatusheight,
		gettitleheight
	} from '@/util/getsysinfo.js'
	import themestore from '@/store/theme.js'
	import {ssetorderstatus} from '@/api/index.js'
	const orderdata=ref()
	onLoad(e=>{
		orderdata.value=JSON.parse(e.data)
	})
	const usethemestore = themestore()
	const heights = getstatusheight() + gettitleheight() + 'px'
	const back = () => {
		uni.navigateBack()
	}
	const zforder=()=>{
		uni.showModal({
			title:"提示",
			content:"非真实支付环境，点击支付",
			success(e) {
				if(e.cancel)return 
				zforder_qx()
			}
		})
	}
	const zforder_qx=async()=>{
		const rudata=await ssetorderstatus({orderid:orderdata.value.orderid, status:1})
		if(rudata.code==200){
			uni.showToast({
				title:"支付成功！",
				icon:"none"
			})
			uni.switchTab({
				url:"/pages/dd/dd"
			})
		}
	}
</script>

<style lang="scss" scoped>
	.conbox {
		height: calc(100vh - v-bind(heights));
		background-color: #eee;
		padding: 20rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: space-between;
        
		.t {
			width: 100%;
			margin-top: 30rpx;
			.price {
				font-size: 45rpx;
				  font-weight: 700;
				  width: 100%;
				  text-align: center;
				  text{
					  font-size: 55rpx;
				  }
			}

			.shopername {
				width: 100%;
				font-size: 25rpx;
				color: #7b7b7b;
				text-align: center;
			}

			.zfaway {
				height: 110rpx;
				background-color: #fff;
				width: 100%;
				border-radius: 15rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 0 25rpx;
				font-size: 30rpx;
				margin-top: 150rpx;
				.l{
					display: flex;
					align-items: center;
					gap: 10rpx;
					.iconfont{
						color: #09bb07;
						font-size: 30rpx;
					}
				}
				radio{
					transform: scale(0.6);
				}
			}
		}

		.b {
			height: 80rpx;
			width: 100%;
			font-size: 30rpx;
			color: #fff;
			background-color: var(--themcolor);
			border-radius: 40rpx;
			line-height: 80rpx;
			text-align: center;
		}
	}

	.fixtop {
		background-color: #eee;
		padding: 0 20rpx;


		.fix-l {
			height: 100%;
			width: 100%;
			display: flex;
			align-items: center;

			.iconfont {
				font-size: 25rpx;
			}
		}

		.fix-c {
			height: 100%;
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 30rpx;
		}
	}
</style>